import java.util.Scanner;

public class test {

    public static void main(String[] args) {
        int n=7;
        for (int i = 31; i >0 ; i-=2) {
            System.out.print(((n>>i)&1)+" ");
        }
        System.out.println();
        for (int i = 30; i >=0 ; i-=2) {
            System.out.print(((n>>i)&1)+" ");
        }
    }

    public static void main11(String[] args) {
        Scanner scan=new Scanner(System.in);
        int count=3;
        while(count!=0){
            System.out.print("请输入密码：");
            String pass=scan.nextLine();
            if(pass.equals ("123"))
            {
                System.out.println("登陆成功");
                break;
            }
            else {
                count--;
                System.out.println("密码错误,还有"+count+"次机会");
            }
        }
    }

    public static void main10(String[] args) {
        int n=123;
        while (n!=0){
            System.out.println(n%10);
            n/=10;
        }
    }

    public static void main9(String[] args) {
        int i=0;
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        for(i=0;i<n;i++){
            int j=0;
            for(j=0;j<n;j++){
                if((i==j)||(i+j)==(n-1)){
                    System.out.print("*");
                }
                else{
                    System.out.print(" ");
                }
            }
            System.out.println();

        }
    }

    public static void main8(String[] args) {
        int i=0;
        double sum=0;
        int flag=1;
        for(i=1;i<=100;i++){
            sum=sum+(double)(1.0/i)*flag;
            flag=-flag;
        }
        System.out.println(sum);
    }

    public static void main7(String[] args) {
        Scanner scan=new Scanner(System.in);
        int num=scan.nextInt();
        int count=0;
//        for (int i = 0; i < 32; i++) {
//            if(((num>>i)&1)!=0){
//                count++;
//            }
//        }
//        while(num!=0){
//            if((num&1)!=0){
//                count++;
//            }7
//            num=num>>>1;
//        }
        while(num!=0){
            num=num&(num-1);
            count++;
        }
        System.out.println(count);
    }

    public static void main6(String[] args) {
        int i = 0;
        for (i = 0; i < 1000; i++) {
            int mid=i;
            int ret1 = mid % 10;
            mid/=10;
            int ret2 = mid % 10;
            mid/=10;
            int ret3 = mid % 10;
            if (i < 10) {
                if (ret1 * ret1 * ret1 == i) {
                    System.out.println(i);
                }
            } else if (i >= 10 && i < 100) {
                if (ret1 * ret1 * ret1 + ret2 * ret2 * ret2 == i) {
                    System.out.println(i);
                }
            } else {
                if (ret1 * ret1 * ret1 + ret2 * ret2 * ret2 + ret3 * ret3 * ret3 == i) {
                    System.out.println(i);
                }
            }
        }
    }



    public static void main5(String[] args) {
        int i=0;
        for(i=1;i<=9;i++){
            int j=0;
            for(j=1;j<=i;j++){
                System.out.print(i+"*"+j+"="+(i*j)+"  ");
            }
            System.out.println();
        }
    }

    public static void main4(String[] args) {
        int year=0;
        for(year=1000;year<=2000;year++){
            if(year%4==0&&year%100!=0){
                System.out.println(year);
            }
            if(year%400==0){
                System.out.println(year);
            }
        }
    }

    public static void main3(String[] args) {
        int num=0;
        for(num=1;num<=100;num++){
            int i=num;
            int flag=0;
            for(i=num-1;i>1;i--){
                if(num%i==0){
                    flag=1;
                    break;
                }
            }
            if(flag==0){
                System.out.println(num+"是素数");
            }
        }
    }

    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num=scan.nextInt();
        int i=num;
        int flag=0;
        for(i=num-1;i>1;i--){
            if(num%i==0){
                System.out.println("该数不是素数");
                flag=1;
                break;
            }
        }
        if(flag==0){
            System.out.println("该数是素数");
        }
    }

    public static void main1(String[] args) {
        Scanner scan=new Scanner(System.in);
        int age=scan.nextInt();
        if(age<=18){
            System.out.println("少年");
        }
        else if(age>=19&&age<=28){
            System.out.println("青年");
        }
        else if(age>=29&&age<=55){
            System.out.println("中年");
        }
        else{
            System.out.println("老年");
        }
    }
}
